package com.chuangjiangx.member.coupon.ddd.domain.model;

import lombok.Getter;

/**
 * Created by zhoufushou on 2017/12/16.
 * 卡券投放渠道
 */
@Getter
public enum ReleaseChannel {
    MEMBER_APPLET("会员小程序&H5", (byte)1),
    COUPON_QR_CODE("卡券二维码", (byte)2),
    SCORE_MARKET("积分商城", (byte)3);

    public final String name;
    public final Byte code;

    ReleaseChannel(String name, Byte code) {
        this.name = name;
        this.code = code;
    }

    public static ReleaseChannel get(Byte code){
        for(ReleaseChannel back : values()){
            if(back.code.equals(code)){
                return back;
            }
        }
        return null;
    }
}
